<template>
  <div class="home">
    <el-col :span="12">
      <el-menu
        default-active="2"
        class="el-menu-vertical-demo"
        @open="handleOpen"
        @close="handleClose"
        background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b"
      >
        <el-menu-item v-for="(item, index) in list[0].children" :key="index"  :index=" index + ''">
          <span slot="title">
            {{ item.title }}
          </span>
        </el-menu-item>

      </el-menu>
    </el-col>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: "Home",
  data() {
    return {
      // list: JSON.parse(sessionStorage.getItem('list'))[0].children
    }
  },
  computed: {
    ...mapState(['list'])
  },
  created() {
    console.log(this.list);
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>
